//
//  BaseTableViewController.swift
//  weibo1
//
//  Created by Apple on 15/11/26.
//  Copyright © 2015年 Apple. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController,LoginViewDelegite {
    //创建一个标示判断用户是否登录
    var userlogin = UserAccountViewModel().userlogin
    var loginView : LoginView?
  
    override func loadView() {
        //加view 
      
        userlogin ? super.loadView():setloginView()
       
        
        
    }
    
    private func setloginView()
    {
       loginView = LoginView()
        view = loginView
    loginView?.LoginDelegite = self
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: "userLogin")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注销", style: .Plain, target: self, action: "userregister")
        
    }
    //实现代理的方法
    func userLogin() {
        //登录跳转新的界面
        let oauth = OAuthViewController()
        let nav = UINavigationController(rootViewController: oauth)
        presentViewController(nav, animated: true, completion: nil)
    }
    func userregister() {
       

    }
}
